From ab8cc82d0195dd6e5f7e2b44be0d126558150beb Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sat, 15 Feb 2020 15:37:45 -0700 Subject: [PATCH] retire route_head_alloc(). (#507) --- alan.cc | 4 ++-- an1.cc | 2 +- bcr.cc | 2 +- bend.cc | 2 +- brauniger_iq.cc | 2 +- bushnell_trl.cc | 2 +- compegps.cc | 4 ++-- cst.cc | 4 ++-- delgpl.cc | 2 +- destinator.cc | 4 ++-- dg-100.cc | 2 +- dmtlog.cc | 8 ++++---- energympro.cc | 2 +- enigma.cc | 2 +- f90g_track.cc | 2 +- format_skeleton.cc | 2 +- g7towin.cc | 4 ++-- garmin.cc | 6 +++--- garmin_fit.cc | 2 +- garmin_txt.cc | 4 ++-- garmin_xt.cc | 4 ++-- gdb.cc | 4 ++-- geojson.cc | 6 +++--- ggv_bin.cc | 4 ++-- ggv_log.cc | 2 +- ggv_ovl.cc | 2 +- globalsat_sport.cc | 2 +- glogbook.cc | 2 +- gnav_trl.cc | 2 +- googledir.cc | 2 +- gopal.cc | 2 +- gpx.cc | 4 ++-- gtm.cc | 4 ++-- gtrnctr.cc | 2 +- hiketech.cc | 2 +- humminbird.cc | 6 +++--- igc.cc | 6 +++--- ignrando.cc | 2 +- igo8.cc | 2 +- ik3d.cc | 2 +- interpolate.cc | 2 +- itracku.cc | 2 +- jogmap.cc | 2 +- jtr.cc | 2 +- kml.cc | 6 +++--- lowranceusr.cc | 6 +++--- magproto.cc | 4 ++-- mapasia.cc | 2 +- mapbar_track.cc | 2 +- mapsend.cc | 4 ++-- mapsource.cc | 4 ++-- mmo.cc | 4 ++-- mtk_locus.cc | 2 +- mtk_logger.cc | 2 +- mynav.cc | 2 +- naviguide.cc | 2 +- navilink.cc | 8 ++++---- navitel.cc | 2 +- nmea.cc | 8 ++++---- nmn4.cc | 2 +- osm.cc | 2 +- ozi.cc | 6 +++--- pcx.cc | 8 ++++---- pocketfms_bc.cc | 2 +- pocketfms_fp.cc | 2 +- psitrex.cc | 4 ++-- radius.cc | 2 +- random.cc | 2 +- raymarine.cc | 2 +- route.cc | 10 +--------- saroute.cc | 6 +++--- sbn.cc | 2 +- sbp.cc | 2 +- shape.cc | 2 +- skyforce.cc | 4 ++-- skytraq.cc | 4 ++-- stmsdf.cc | 4 ++-- stmwpp.cc | 4 ++-- tef_xml.cc | 2 +- tpo.cc | 6 +++--- trackfilter.cc | 4 ++-- transform.cc | 6 +++--- unicsv.cc | 4 ++-- units.cc | 2 +- v900.cc | 2 +- vidaone.cc | 2 +- vitosmt.cc | 18 +++++++++--------- vitovtt.cc | 6 +++--- vpl.cc | 2 +- wbt-200.cc | 4 ++-- wintec_tes.cc | 2 +- xcsv.cc | 4 ++-- xol.cc | 2 +- 93 files changed, 159 insertions(+), 167 deletions(-) diff --git a/alan.cc b/alan.cc index d1962b22a..03afc404a 100644 --- a/alan.cc +++ b/alan.cc @@ -537,7 +537,7 @@ static void wpr_read() } struct rte* rte = &(wprdata.rte[idx]); - route_head* RT = route_head_alloc(); + auto* RT = new route_head; RT->rte_num = i; for (j=RTE_NAME_LEN-1; j >= 0 && rte->name[j] == ' '; j--) {} char *s = xstrndup(rte->name,j+1); @@ -590,7 +590,7 @@ static void trl_read() if (trkhdr->occupied == TRK_UNUSED) { continue; } - route_head* TL = route_head_alloc(); + auto* TL = new route_head; for (j=TRK_NAME_LEN-1; j >= 0 && (trkhdr->name[j] == ' ' || trkhdr->name[j] == '\0'); j--) {} diff --git a/an1.cc b/an1.cc index af9c1d7f7..18c7aa867 100644 --- a/an1.cc +++ b/an1.cc @@ -803,7 +803,7 @@ static void Read_AN1_Lines(gbfile* f) an1_line_record* rec = Alloc_AN1_Line(); Read_AN1_Line(f, rec); /* create route rec */ - route_head* rte_head = route_head_alloc(); + auto* rte_head = new route_head; rte_head->line_color.bbggrr = rec->linecolor; if (rec->opacity == 0x8200) { rte_head->line_color.opacity = 128; diff --git a/bcr.cc b/bcr.cc index 198c700d2..67f58732c 100644 --- a/bcr.cc +++ b/bcr.cc @@ -246,7 +246,7 @@ bcr_data_read() { QString str; - route_head* route = route_head_alloc(); + auto* route = new route_head; str = inifile_readstr(ini, "client", "routename"); if (!str.isNull()) { diff --git a/bend.cc b/bend.cc index 182339aef..22b0e639b 100644 --- a/bend.cc +++ b/bend.cc @@ -146,7 +146,7 @@ void BendFilter::process_route(const route_head* route_orig, route_head* route_d void BendFilter::process_route_orig(const route_head* route_orig) { - route_head* route_dest = route_head_alloc(); + auto* route_dest = new route_head; route_dest->rte_name = route_orig->rte_name; route_dest->rte_desc = route_orig->rte_desc; route_dest->fs = fs_chain_copy(route_orig->fs); diff --git a/brauniger_iq.cc b/brauniger_iq.cc index 345dfa435..b1d36bc13 100644 --- a/brauniger_iq.cc +++ b/brauniger_iq.cc @@ -194,7 +194,7 @@ static int process_data(const unsigned char* data) printf(MYNAME ": End Time: %s", ctime(&finish)); } if (remaining) { - track = route_head_alloc(); + track = new route_head; track->rte_name = PRESTRKNAME; track->rte_desc = "Brauniger-IQ Barograph"; track_add_head(track); diff --git a/bushnell_trl.cc b/bushnell_trl.cc index acf80a6d1..d39da5dda 100644 --- a/bushnell_trl.cc +++ b/bushnell_trl.cc @@ -39,7 +39,7 @@ rd_init(const QString& fname) file_in = gbfopen_le(fname, "rb", MYNAME); gbfread(h, 1, sizeof(h), file_in); - trk_head = route_head_alloc(); + trk_head = new route_head; track_add_head(trk_head); trk_head->rte_name = lrtrim(h); diff --git a/compegps.cc b/compegps.cc index 817b135af..aa0414477 100644 --- a/compegps.cc +++ b/compegps.cc @@ -425,7 +425,7 @@ compegps_data_read() } break; case 'R': - route = route_head_alloc(); + route = new route_head; route_add_head(route); parse_rte_info(ctail, route); break; @@ -449,7 +449,7 @@ compegps_data_read() wpt = parse_trkpt(ctail); if (wpt != nullptr) { if (track == nullptr) { - track = route_head_alloc(); + track = new route_head; track_add_head(track); } track_add_wpt(track, wpt); diff --git a/cst.cc b/cst.cc index 57079349c..069843799 100644 --- a/cst.cc +++ b/cst.cc @@ -63,7 +63,7 @@ cst_add_wpt(route_head* track, Waypoint* wpt) wpt->urls.clear(); if (temp_route == nullptr) { - temp_route = route_head_alloc(); + temp_route = new route_head; route_add_head(temp_route); } route_add_wpt(temp_route, new Waypoint(*wpt)); @@ -267,7 +267,7 @@ cst_data_read() data_lines++; if (strcmp(name, "1") == 0) { - track = route_head_alloc(); + track = new route_head; track_add_head(track); } else if (strncmp(name, "NAME:", 5) == 0) { wpt->shortname = QString::fromLatin1(name + 5); diff --git a/delgpl.cc b/delgpl.cc index d6b6fa3a7..6e7ae6e4e 100644 --- a/delgpl.cc +++ b/delgpl.cc @@ -53,7 +53,7 @@ gpl_read() { gpl_point_t gp; - route_head* track_head = route_head_alloc(); + auto* track_head = new route_head; track_add_head(track_head); while (gbfread(&gp, sizeof(gp), 1, gplfile_in) > 0) { diff --git a/destinator.cc b/destinator.cc index 63b07128c..e0b42272c 100644 --- a/destinator.cc +++ b/destinator.cc @@ -250,7 +250,7 @@ destinator_read_rte() } if (! rte) { - rte = route_head_alloc(); + rte = new route_head; route_add_head(rte); } route_add_wpt(rte, wpt); @@ -318,7 +318,7 @@ destinator_read_trk() } if (! trk) { - trk = route_head_alloc(); + trk = new route_head; track_add_head(trk); } track_add_wpt(trk, wpt); diff --git a/dg-100.cc b/dg-100.cc index aad99509e..6535ff99a 100644 --- a/dg-100.cc +++ b/dg-100.cc @@ -264,7 +264,7 @@ process_gpsfile(uint8_t data[], route_head** track) strncpy(buf, model->name, sizeof(buf)); strftime(&buf[strlen(model->name)], sizeof(buf)-strlen(model->name), " tracklog (%Y/%m/%d %H:%M:%S)", gmtime(&creation_time)); - *track = route_head_alloc(); + *track = new route_head; (*track)->rte_name = buf; (*track)->rte_desc = "GPS tracklog data"; track_add_head(*track); diff --git a/dmtlog.cc b/dmtlog.cc index bac604738..7497eb3b1 100644 --- a/dmtlog.cc +++ b/dmtlog.cc @@ -215,7 +215,7 @@ static void tlog3b_xgcb_tfna(xg_string args, const QXmlStreamAttributes*) { if (xmltrk == nullptr) { - xmltrk = route_head_alloc(); + xmltrk = new route_head; track_add_head(xmltrk); } xmltrk->rte_name = args; @@ -226,7 +226,7 @@ static void tlog3b_xgcb_tfdes(xg_string args, const QXmlStreamAttributes*) { if (xmltrk == nullptr) { - xmltrk = route_head_alloc(); + xmltrk = new route_head; track_add_head(xmltrk); } xmltrk->rte_desc = args; @@ -255,7 +255,7 @@ tlog3b_xgcb_tpten(xg_string, const QXmlStreamAttributes*) finalize_pt(xmlwpt); if (xmltrk == nullptr) { - xmltrk = route_head_alloc(); + xmltrk = new route_head; track_add_head(xmltrk); } track_add_wpt(xmltrk, xmlwpt); @@ -422,7 +422,7 @@ read_CTrackFile(const int version) (void) gbfgetint32(fin); // Unknown 3 (void) gbfgetint32(fin); // Unknown 4 - route_head* track = route_head_alloc(); + auto* track = new route_head; track_add_head(track); /* S1 .. S9: comments, hints, jokes, aso */ diff --git a/energympro.cc b/energympro.cc index dd133c078..bfe890bae 100644 --- a/energympro.cc +++ b/energympro.cc @@ -263,7 +263,7 @@ track_read() QTime gpsTime = QTime(workout.timeStart.Hour,workout.timeStart.Minute,workout.timeStart.Second); gpsbabel::DateTime gpsDateTime = gpsbabel::DateTime(gpsDate,gpsTime); gpsDateTime.setTimeSpec(Qt::UTC); - route_head* gpsbabel_route = route_head_alloc(); + auto* gpsbabel_route = new route_head; track_add_head(gpsbabel_route); gbfseek(file_in, 0L, SEEK_SET); diff --git a/enigma.cc b/enigma.cc index 36a33f825..c9c4ca84c 100644 --- a/enigma.cc +++ b/enigma.cc @@ -104,7 +104,7 @@ static void data_read() { enigma_wpt ewpt; - route_head* route = route_head_alloc(); + auto* route = new route_head; route_add_head(route); while (1 == gbfread(&ewpt, sizeof(ewpt), 1, file_in)) { diff --git a/f90g_track.cc b/f90g_track.cc index cc2af43f0..90be17faf 100644 --- a/f90g_track.cc +++ b/f90g_track.cc @@ -67,7 +67,7 @@ f90g_track_rd_init(const QString& fname) fatal(MYNAME ": bad header"); } // start the track list - track = route_head_alloc(); + track = new route_head; is_fatal((track == nullptr), MYNAME ": memory non-enough"); track->rte_name = fname; track_add_head(track); diff --git a/format_skeleton.cc b/format_skeleton.cc index 1716fa581..e84f36e5a 100644 --- a/format_skeleton.cc +++ b/format_skeleton.cc @@ -89,7 +89,7 @@ format_skeleton_read() // // For routes: // -// route = route_head_alloc(); +// route = new route_head; // populate struct route_hdr // route_add_head(route); // while (have more routepoints) { diff --git a/g7towin.cc b/g7towin.cc index cc16aa380..ed2fa0552 100644 --- a/g7towin.cc +++ b/g7towin.cc @@ -519,7 +519,7 @@ data_read() case 'N': /* track log header */ mode = trkdata; - head = route_head_alloc(); + head = new route_head; cdata = strchr(cdata, '-'); if (cdata) { while (isspace(*cdata)) { @@ -542,7 +542,7 @@ data_read() case 'R': /* route header */ mode = rtedata; - head = route_head_alloc(); + head = new route_head; cdata += 3; /*skip route number */ if (*cdata) { head->rte_name = cdata; diff --git a/garmin.cc b/garmin.cc index 59c9f6445..a31865444 100644 --- a/garmin.cc +++ b/garmin.cc @@ -515,7 +515,7 @@ track_read() } if (trk_head == nullptr || array[i]->ishdr) { - trk_head = route_head_alloc(); + trk_head = new route_head; trk_head->rte_num = trk_num; trk_head->rte_name = QString::fromLatin1(trk_name); trk_num++; @@ -593,7 +593,7 @@ route_read() default: break; } - rte_head = route_head_alloc(); + rte_head = new route_head; route_add_head(rte_head); if (csrc) { rte_head->rte_name = QString::fromLatin1(csrc); @@ -650,7 +650,7 @@ lap_read_as_track(void) ) { static struct tm* stmp; stmp = gmtime(&array[i]->start_time); - trk_head = route_head_alloc(); + trk_head = new route_head; /*For D906, we would like to use the track_index in the last packet instead...*/ trk_head->rte_num = ++trk_num; strftime(tbuf, 32, "%Y-%m-%dT%H:%M:%SZ", stmp); diff --git a/garmin_fit.cc b/garmin_fit.cc index 9189f83b6..fdc4b61a3 100644 --- a/garmin_fit.cc +++ b/garmin_fit.cc @@ -875,7 +875,7 @@ fit_read() { fit_parse_header(); - fit_data.track = route_head_alloc(); + fit_data.track = new route_head; track_add_head(fit_data.track); if (global_opts.debug_level >= 1) { debug_print(1,"%s: starting to read data with fit_data.len=%d\n", MYNAME, fit_data.len); diff --git a/garmin_txt.cc b/garmin_txt.cc index 0ea891feb..9abbeda58 100644 --- a/garmin_txt.cc +++ b/garmin_txt.cc @@ -1189,7 +1189,7 @@ parse_route_header() char* str; int column = -1; - route_head* rte = route_head_alloc(); + auto* rte = new route_head; bind_fields(route_header); while ((str = csv_lineparse(nullptr, "\t", "", column++))) { @@ -1214,7 +1214,7 @@ parse_track_header() int column = -1; bind_fields(track_header); - route_head* trk = route_head_alloc(); + auto* trk = new route_head; while ((str = csv_lineparse(nullptr, "\t", "", column++))) { int field_no = header_fields[track_header][column]; switch (field_no) { diff --git a/garmin_xt.cc b/garmin_xt.cc index b1d18caf0..5bc151c96 100644 --- a/garmin_xt.cc +++ b/garmin_xt.cc @@ -250,7 +250,7 @@ format_garmin_xt_proc_strk() // Generate Track Header uint16_t trackbytes = format_garmin_xt_rd_st_attrs(trk_name, &trk_color) - 50; // Bytes in track - route_head* tmp_track = route_head_alloc(); + auto* tmp_track = new route_head; // update track color tmp_track->line_color.bbggrr = colors[trk_color]; tmp_track->line_color.opacity = 255; @@ -334,7 +334,7 @@ format_garmin_xt_proc_atrk() } if (! track) { - track = route_head_alloc(); + track = new route_head; // header option was not set to ignore if (method !=1) { track->rte_name = "ATRK XT"; diff --git a/gdb.cc b/gdb.cc index c7ca33874..1621a8bf8 100644 --- a/gdb.cc +++ b/gdb.cc @@ -661,7 +661,7 @@ read_route() rte_ct++; int warnings = 0; - route_head* rte = route_head_alloc(); + auto* rte = new route_head; rte->rte_name = fread_cstr(); FREAD(buf, 1); /* display/autoname - 1 byte */ @@ -866,7 +866,7 @@ read_track() trk_ct++; - route_head* res = route_head_alloc(); + auto* res = new route_head; res->rte_name = fread_cstr(); // res->rte_num = trk_ct; diff --git a/geojson.cc b/geojson.cc index 2ea354e41..9776f5fdf 100644 --- a/geojson.cc +++ b/geojson.cc @@ -146,7 +146,7 @@ routes_from_polygon_coordinates(const QJsonArray& polygon) for (auto && lineStringIterator : polygon) { QJsonArray coordinates = (lineStringIterator).toArray(); - auto route = route_head_alloc(); + auto* route = new route_head; route_add_head(route); for (auto && coordinate : coordinates) { @@ -225,7 +225,7 @@ geojson_read() { else if (geometry_type == LINESTRING) { QJsonArray coordinates = geometry.value(COORDINATES).toArray(); - auto route = route_head_alloc(); + auto* route = new route_head; route->rte_name = name; route_add_head(route); for (auto && coordinate : coordinates) @@ -254,7 +254,7 @@ geojson_read() { for (auto && line_string : line_strings) { QJsonArray coordinates = line_string.toArray(); - auto route = route_head_alloc(); + auto* route = new route_head; track_add_head(route); for (auto && coordinate : coordinates) { diff --git a/ggv_bin.cc b/ggv_bin.cc index 8d244128a..550bee5ef 100644 --- a/ggv_bin.cc +++ b/ggv_bin.cc @@ -189,7 +189,7 @@ GgvBinFormat::ggv_bin_read_v2(QDataStream& stream) ggv_bin_read16(stream, "line width"); ggv_bin_read16(stream, "line type"); line_points = ggv_bin_read16(stream, "line points"); - ggv_bin_track = route_head_alloc(); + ggv_bin_track = new route_head; track_add_head(ggv_bin_track); if (! track_name.isEmpty()) { ggv_bin_track->rte_name = track_name; @@ -350,7 +350,7 @@ GgvBinFormat::ggv_bin_read_v34_record(QDataStream& stream) // area case 0x17: // line - ggv_bin_track = route_head_alloc(); + ggv_bin_track = new route_head; track_add_head(ggv_bin_track); if (! label.isEmpty()) { diff --git a/ggv_log.cc b/ggv_log.cc index 56cf9f6ae..1df0824a8 100644 --- a/ggv_log.cc +++ b/ggv_log.cc @@ -118,7 +118,7 @@ ggv_log_read() } if (trk == nullptr) { - trk = route_head_alloc(); + trk = new route_head; track_add_head(trk); } diff --git a/ggv_ovl.cc b/ggv_ovl.cc index 7eb70d84c..c14671e81 100644 --- a/ggv_ovl.cc +++ b/ggv_ovl.cc @@ -125,7 +125,7 @@ ggv_ovl_read() if (points > 0) { route_head* trk; - route_head* rte = trk = route_head_alloc(); + auto* rte = trk = new route_head; if (group > 1) { route_add_head(rte); route_ct++; diff --git a/globalsat_sport.cc b/globalsat_sport.cc index c016b3977..c8c8098d0 100644 --- a/globalsat_sport.cc +++ b/globalsat_sport.cc @@ -527,7 +527,7 @@ track_read() } if (!showlist) { - route_head* trk = route_head_alloc(); + auto* trk = new route_head; trk->rte_name = QString::asprintf("%02d-%02d-%02d_%02d:%02d:%02d", header.dateStart.Year, diff --git a/glogbook.cc b/glogbook.cc index 27fe70f59..833229873 100644 --- a/glogbook.cc +++ b/glogbook.cc @@ -140,7 +140,7 @@ glogbook_write() void gl_trk_s(xg_string, const QXmlStreamAttributes*) { - trk_head = route_head_alloc(); + trk_head = new route_head; track_add_head(trk_head); } diff --git a/gnav_trl.cc b/gnav_trl.cc index c300d7d0c..7caed79e6 100644 --- a/gnav_trl.cc +++ b/gnav_trl.cc @@ -103,7 +103,7 @@ gnav_trl_read() wpt->altitude = read_altitude(&rec.alt); if (trk == nullptr) { - trk = route_head_alloc(); + trk = new route_head; track_add_head(trk); } track_add_wpt(trk, wpt); diff --git a/googledir.cc b/googledir.cc index 26e81f271..f1d6b2f4d 100644 --- a/googledir.cc +++ b/googledir.cc @@ -93,7 +93,7 @@ goog_poly_e(xg_string args, const QXmlStreamAttributes*) long lon = 0; const QByteArray qbstr = encoded_points.toUtf8(); - route_head* routehead = route_head_alloc(); + auto* routehead = new route_head; if (args == "overview_polyline") { routehead->rte_name = "overview"; routehead->rte_desc = "Overview"; diff --git a/gopal.cc b/gopal.cc index bf211c0ef..eff2b0477 100644 --- a/gopal.cc +++ b/gopal.cc @@ -176,7 +176,7 @@ gopal_read() double lat_old = 0; - route_head* route = route_head_alloc(); + auto* route = new route_head; QDateTime qtx = QDateTime::fromSecsSinceEpoch(tx, Qt::UTC); route->rte_name = "Tracklog "; route->rte_name += qtx.toString(Qt::ISODate); diff --git a/gpx.cc b/gpx.cc index cb1be39b6..e55e7e0bd 100644 --- a/gpx.cc +++ b/gpx.cc @@ -349,7 +349,7 @@ GpxFormat::gpx_start(const QString& el, const QXmlStreamAttributes& attr) } break; case tt_rte: - rte_head = route_head_alloc(); + rte_head = new route_head; route_add_head(rte_head); rh_link_ = new UrlLink; fs_ptr = &rte_head->fs; @@ -358,7 +358,7 @@ GpxFormat::gpx_start(const QString& el, const QXmlStreamAttributes& attr) tag_wpt(attr); break; case tt_trk: - trk_head = route_head_alloc(); + trk_head = new route_head; track_add_head(trk_head); rh_link_ = new UrlLink; fs_ptr = &trk_head->fs; diff --git a/gtm.cc b/gtm.cc index 1f0175145..01f92f401 100644 --- a/gtm.cc +++ b/gtm.cc @@ -575,7 +575,7 @@ gtm_read() wpt->altitude = unknown_alt; } if (start_new || !trk_head) { - trk_head = route_head_alloc(); + trk_head = new route_head; track_add_head(trk_head); real_track_list.append(trk_head); } @@ -628,7 +628,7 @@ gtm_read() fread_discard(file_in, 2); if (start_new || !rte_head) { - rte_head = route_head_alloc(); + rte_head = new route_head; rte_head->rte_name = route_name; route_add_head(rte_head); } diff --git a/gtrnctr.cc b/gtrnctr.cc index f5a3a248a..831fb7b9a 100644 --- a/gtrnctr.cc +++ b/gtrnctr.cc @@ -467,7 +467,7 @@ gtc_write() void gtc_trk_s(xg_string, const QXmlStreamAttributes*) { - trk_head = route_head_alloc(); + trk_head = new route_head; track_add_head(trk_head); } diff --git a/hiketech.cc b/hiketech.cc index 938063846..ebae53697 100644 --- a/hiketech.cc +++ b/hiketech.cc @@ -235,7 +235,7 @@ void ht_wpt_e(xg_string, const QXmlStreamAttributes*) static void ht_trk_s(xg_string, const QXmlStreamAttributes*) { - trk_head = route_head_alloc(); + trk_head = new route_head; track_add_head(trk_head); } diff --git a/humminbird.cc b/humminbird.cc index a7f9b23bf..7f1225273 100644 --- a/humminbird.cc +++ b/humminbird.cc @@ -352,7 +352,7 @@ humminbird_read_route(gbfile* fin) if ((map.value(buff))) { const Waypoint* wpt = map.value(buff); if (rte == nullptr) { - rte = route_head_alloc(); + rte = new route_head; route_add_head(rte); // TODO: find a way to eliminate the copy. char* s = xstrndup(hrte.name, sizeof(hrte.name)); @@ -411,7 +411,7 @@ humminbird_read_track(gbfile* fin) int32_t accum_east = th.start_east; int32_t accum_north = th.start_north; - route_head* trk = route_head_alloc(); + auto* trk = new route_head; track_add_head(trk); // TODO: find a way to eliminate the copy. @@ -518,7 +518,7 @@ humminbird_read_track_old(gbfile* fin) int32_t accum_east = th.start_east; int32_t accum_north = th.start_north; - route_head* trk = route_head_alloc(); + auto* trk = new route_head; track_add_head(trk); /* The name is not in the header, but at the end of the file. diff --git a/igc.cc b/igc.cc index 0dbbafed3..536804658 100644 --- a/igc.cc +++ b/igc.cc @@ -200,7 +200,7 @@ static void igc_task_rec(const char* rec) creation = mkgmtime(&tm); // Create a route to store the task data in. - rte_head = route_head_alloc(); + rte_head = new route_head; rte_head->rte_name = task_num; rte_head->rte_desc = QStringLiteral(DATEMAGIC) + flight_date + QStringLiteral(": ") + task_desc; route_add_head(rte_head); @@ -346,14 +346,14 @@ static void data_read() } // Create a track for pressure altitude waypoints if (!pres_head) { - pres_head = route_head_alloc(); + pres_head = new route_head; pres_head->rte_name = PRESTRKNAME; pres_head->rte_desc = trk_desc; track_add_head(pres_head); } // Create a second track for GNSS altitude waypoints if (!gnss_head) { - gnss_head = route_head_alloc(); + gnss_head = new route_head; gnss_head->rte_name = GNSSTRKNAME; gnss_head->rte_desc = trk_desc; track_add_head(gnss_head); diff --git a/ignrando.cc b/ignrando.cc index 111d2923d..1136d5504 100644 --- a/ignrando.cc +++ b/ignrando.cc @@ -75,7 +75,7 @@ ignr_start(xg_string, const QXmlStreamAttributes*) { ignr_xml_error((track != nullptr)); - track = route_head_alloc(); + track = new route_head; track_add_head(track); } diff --git a/igo8.cc b/igo8.cc index 9dbabccd9..111f7bd1a 100644 --- a/igo8.cc +++ b/igo8.cc @@ -165,7 +165,7 @@ static void igo8_read() { igo8_point point; - route_head* track_head = route_head_alloc(); + auto* track_head = new route_head; track_add_head(track_head); while (in_point_count && diff --git a/ik3d.cc b/ik3d.cc index a204626e0..449113ecf 100644 --- a/ik3d.cc +++ b/ik3d.cc @@ -111,7 +111,7 @@ iktobj_type(xg_string args, const QXmlStreamAttributes*) waypt = new Waypoint; break; case 1: - track = route_head_alloc(); + track = new route_head; break; default: fatal(MYNAME ": Unknown object type %s!\n", qPrintable(args)); diff --git a/interpolate.cc b/interpolate.cc index ee4c7be41..9d245182c 100644 --- a/interpolate.cc +++ b/interpolate.cc @@ -55,7 +55,7 @@ void InterpolateFilter::process() // time is not maintainable. When new members are added it is likely // they will not be copied here! // We want a deep copy of everything but with an empty WaypointList. - route_head* rte_new = route_head_alloc(); + auto* rte_new = new route_head; rte_new->rte_name = rte_old->rte_name; rte_new->rte_desc = rte_old->rte_desc; rte_new->rte_urls = rte_old->rte_urls; diff --git a/itracku.cc b/itracku.cc index dbab699a9..804d42836 100644 --- a/itracku.cc +++ b/itracku.cc @@ -605,7 +605,7 @@ itracku_read_trk_waypt_add(Waypoint* wpt) static void itracku_read_trk() { - itracku_read_trk_track = route_head_alloc(); + itracku_read_trk_track = new route_head; track_add_head(itracku_read_trk_track); itracku_waypt_input(&itracku_read_trk_waypt_add); } diff --git a/jogmap.cc b/jogmap.cc index 4dbe22958..1cc326400 100644 --- a/jogmap.cc +++ b/jogmap.cc @@ -44,7 +44,7 @@ static QVector jogmap_args = { static void jogmap_markers(xg_string, const QXmlStreamAttributes*) { - trk = route_head_alloc(); + trk = new route_head; track_add_head(trk); } diff --git a/jtr.cc b/jtr.cc index e4a5b90fe..2a863e816 100644 --- a/jtr.cc +++ b/jtr.cc @@ -236,7 +236,7 @@ jtr_read() } if (trk == nullptr) { - trk = route_head_alloc(); + trk = new route_head; track_add_head(trk); } diff --git a/kml.cc b/kml.cc index 1bd5011a5..f218db759 100644 --- a/kml.cc +++ b/kml.cc @@ -410,7 +410,7 @@ void wpt_icon(xg_string args, const QXmlStreamAttributes*) void trk_coord(xg_string args, const QXmlStreamAttributes*) { - route_head* trk_head = route_head_alloc(); + auto* trk_head = new route_head; if (wpt_tmp && !wpt_tmp->shortname.isEmpty()) { trk_head->rte_name = wpt_tmp->shortname; } @@ -459,7 +459,7 @@ void trk_coord(xg_string args, const QXmlStreamAttributes*) void gx_trk_s(xg_string, const QXmlStreamAttributes*) { - gx_trk_head = route_head_alloc(); + gx_trk_head = new route_head; if (wpt_tmp && !wpt_tmp->shortname.isEmpty()) { gx_trk_head->rte_name = wpt_tmp->shortname; } @@ -2147,7 +2147,7 @@ kml_wr_position(Waypoint* wpt) kml_wr_init(posnfilenametmp); if (!posn_trk_head) { - posn_trk_head = route_head_alloc(); + posn_trk_head = new route_head; track_add_head(posn_trk_head); } diff --git a/lowranceusr.cc b/lowranceusr.cc index dd9164bae..414a8af64 100644 --- a/lowranceusr.cc +++ b/lowranceusr.cc @@ -1287,7 +1287,7 @@ lowranceusr_parse_routes() } for (int i = 0; i < num_routes; i++) { - rte_head = route_head_alloc(); + rte_head = new route_head; route_add_head(rte_head); rte_head->rte_num = i+1; @@ -1395,7 +1395,7 @@ lowranceusr_parse_trail(int* trail_num) char continuous = gbfgetc(file_in); if (!continuous && opt_seg_break && j) { /* option to break trails into segments was specified */ - auto trk_tmp = route_head_alloc(); + auto* trk_tmp = new route_head; trk_tmp->rte_num = ++(*trail_num); trk_tmp->rte_name = trk_head->rte_name; track_add_head(trk_tmp); @@ -1582,7 +1582,7 @@ lowranceusr_parse_trails() } for (int i = trail_num = 0; i < num_trails && !gbfeof(file_in); i++) { - trk_head = route_head_alloc(); + trk_head = new route_head; trk_head->rte_num = ++trail_num; track_add_head(trk_head); diff --git a/magproto.cc b/magproto.cc index a96301ca4..1df7fcd21 100644 --- a/magproto.cc +++ b/magproto.cc @@ -532,7 +532,7 @@ retry: * from input filename. */ - trk_head = route_head_alloc(); + trk_head = new route_head; /* Whack trailing extension if present. */ QString s = get_filename(curfname); @@ -1121,7 +1121,7 @@ mag_rteparse(char* rtemsg) */ if (frag == mag_rte_head->nelems) { - route_head* rte_head = route_head_alloc(); + auto* rte_head = new route_head; route_add_head(rte_head); rte_head->rte_num = rtenum; rte_head->rte_name = rte_name; diff --git a/mapasia.cc b/mapasia.cc index 612e74ff5..53a4af5de 100644 --- a/mapasia.cc +++ b/mapasia.cc @@ -145,7 +145,7 @@ tr7_read() } if (! trk) { - trk = route_head_alloc(); + trk = new route_head; track_add_head(trk); } track_add_wpt(trk, wpt); diff --git a/mapbar_track.cc b/mapbar_track.cc index c774a54e2..25c64aa65 100644 --- a/mapbar_track.cc +++ b/mapbar_track.cc @@ -80,7 +80,7 @@ read_waypoint() static void mapbar_track_read() { - route_head* track = route_head_alloc(); + auto* track = new route_head; is_fatal((track == nullptr), MYNAME ": memory non-enough"); track_add_head(track); diff --git a/mapsend.cc b/mapsend.cc index b21dea8da..d529f34d0 100644 --- a/mapsend.cc +++ b/mapsend.cc @@ -153,7 +153,7 @@ mapsend_wpt_read() int rte_count = gbfgetint32(mapsend_file_in); while (rte_count--) { - route_head* rte_head = route_head_alloc(); + auto* rte_head = new route_head; route_add_head(rte_head); /* route name */ @@ -195,7 +195,7 @@ mapsend_wpt_read() static void mapsend_track_read() { - route_head* track_head = route_head_alloc(); + auto* track_head = new route_head; track_head->rte_name = gbfgetpstr(mapsend_file_in); track_add_head(track_head); diff --git a/mapsource.cc b/mapsource.cc index 084b42778..2c7872f96 100644 --- a/mapsource.cc +++ b/mapsource.cc @@ -902,7 +902,7 @@ mps_route_r(gbfile* mps_file, int mps_ver, route_head** rte) fprintf(stderr, "mps_route_r: route contains %d waypoints\n", rte_count); #endif - rte_head = route_head_alloc(); + rte_head = new route_head; rte_head->rte_name = rtename; route_add_head(rte_head); *rte = rte_head; @@ -1468,7 +1468,7 @@ mps_track_r(gbfile* mps_file, int mps_ver, route_head** trk) fprintf(stderr, "mps_track_r: there are %d track waypoints\n", trk_count); #endif - track_head = route_head_alloc(); + track_head = new route_head; track_head->rte_name = trkname; track_add_head(track_head); *trk = track_head; diff --git a/mmo.cc b/mmo.cc index 99be7d9a7..bdb477ffd 100644 --- a/mmo.cc +++ b/mmo.cc @@ -555,7 +555,7 @@ mmo_read_CObjRoute(mmo_data_t* data) DBG((sobj, "name = \"%s\" [ visible=%s, id=0x%04X ]\n", data->name, data->visible ? "yes" : "NO", data->objid)); - data->data = rte = route_head_alloc(); + data->data = rte = new route_head; rte->rte_name = data->name; route_add_head(rte); @@ -627,7 +627,7 @@ mmo_read_CObjTrack(mmo_data_t* data) DBG((sobj, "name = \"%s\" [ visible=%s, id=0x%04X ]\n", data->name, data->visible ? "yes" : "NO", data->objid)); - route_head* trk = route_head_alloc(); + auto* trk = new route_head; trk->rte_name = data->name; track_add_head(trk); diff --git a/mtk_locus.cc b/mtk_locus.cc index 912da92a2..454077770 100644 --- a/mtk_locus.cc +++ b/mtk_locus.cc @@ -158,7 +158,7 @@ mtk_locus_rd_deinit() static void mtk_locus_read() { - track = route_head_alloc(); + track = new route_head; track_add_head(track); dbg(1, "Track initialized\n"); diff --git a/mtk_logger.cc b/mtk_logger.cc index ea1297504..b44603e87 100644 --- a/mtk_logger.cc +++ b/mtk_logger.cc @@ -807,7 +807,7 @@ static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm) if (global_opts.masked_objective& TRKDATAMASK && (trk_head == nullptr || (mtk_info.track_event & MTK_EVT_START))) { char spds[50]; - trk_head = route_head_alloc(); + trk_head = new route_head; trk_head->rte_name = QString("track-%1").arg(1 + track_count()); spds[0] = '\0'; diff --git a/mynav.cc b/mynav.cc index 29830f9ee..95a614ac2 100644 --- a/mynav.cc +++ b/mynav.cc @@ -126,7 +126,7 @@ MyNavFormat::read() gpsbabel::TextStream stream; stream.open(read_fname, QIODevice::ReadOnly, "mynav"); - route_head* track = route_head_alloc(); + auto* track = new route_head; track_add_head(track); QString buf; diff --git a/naviguide.cc b/naviguide.cc index 2eebe0bc6..648e64e9b 100644 --- a/naviguide.cc +++ b/naviguide.cc @@ -362,7 +362,7 @@ static void data_read() { if (process_rte) { - rte_head = route_head_alloc(); + rte_head = new route_head; route_add_head(rte_head); } diff --git a/navilink.cc b/navilink.cc index 1da5def69..550a62d62 100644 --- a/navilink.cc +++ b/navilink.cc @@ -549,7 +549,7 @@ serial_read_track() unsigned int address = le_read32(information + 4); unsigned short total = le_read16(information + 12); - route_head* track = route_head_alloc(); + auto* track = new route_head; track_add_head(track); while (total > 0) { @@ -657,7 +657,7 @@ serial_read_routes(Waypoint** waypts) write_packet(PID_QRY_ROUTE, payload, sizeof(payload)); read_packet(PID_DATA, routedata, 64, sizeof(routedata), false); - route_head* route = route_head_alloc(); + auto* route = new route_head; route->rte_num = routedata[2]; route->rte_name = (char*)routedata + 4; route_add_head(route); @@ -906,7 +906,7 @@ serial_read_datalog() read_datalog_info(&seg1_addr, &seg1_len, &seg2_addr, &seg2_len); - route_head* track = route_head_alloc(); + auto* track = new route_head; track_add_head(track); if (seg1_len) { @@ -940,7 +940,7 @@ file_read() default: if (global_opts.masked_objective & TRKDATAMASK) { if (track == nullptr) { - track = route_head_alloc(); + track = new route_head; track_add_head(track); } diff --git a/navitel.cc b/navitel.cc index 645468003..5c9329f2c 100644 --- a/navitel.cc +++ b/navitel.cc @@ -62,7 +62,7 @@ navitel_read_track() wpt->longitude = GPS_Math_Semi_To_Deg(lon); if ((lat >> 31) || (trk == nullptr)) { - trk = route_head_alloc(); + trk = new route_head; track_add_head(trk); } track_add_wpt(trk, wpt); diff --git a/nmea.cc b/nmea.cc index 6100292b3..82287e4a7 100644 --- a/nmea.cc +++ b/nmea.cc @@ -411,7 +411,7 @@ static void gpgll_parse(char* ibuf) { if (trk_head == nullptr) { - trk_head = route_head_alloc(); + trk_head = new route_head; track_add_head(trk_head); } @@ -466,7 +466,7 @@ static void gpgga_parse(char* ibuf) { if (trk_head == nullptr) { - trk_head = route_head_alloc(); + trk_head = new route_head; track_add_head(trk_head); } @@ -562,7 +562,7 @@ static void gprmc_parse(char* ibuf) { if (trk_head == nullptr) { - trk_head = route_head_alloc(); + trk_head = new route_head; track_add_head(trk_head); } @@ -868,7 +868,7 @@ pcmpt_parse(char* ibuf) * we can rip through the queue forward now to get our * handy-dandy reversing effect. */ - route_head* trk_head = route_head_alloc(); + auto* trk_head = new route_head; track_add_head(trk_head); while (!pcmpt_head.isEmpty()) { Waypoint* wpt = pcmpt_head.takeFirst(); diff --git a/nmn4.cc b/nmn4.cc index 3a8134f8b..f083e17e2 100644 --- a/nmn4.cc +++ b/nmn4.cc @@ -68,7 +68,7 @@ nmn4_read_data() QString zip2, city, street, number; - route_head* route = route_head_alloc(); + auto* route = new route_head; route_add_head(route); while ((buff = gbfgetstr(fin))) { diff --git a/osm.cc b/osm.cc index 4ee4a4cb5..c710b12e5 100644 --- a/osm.cc +++ b/osm.cc @@ -575,7 +575,7 @@ osm_node_tag(xg_string, const QXmlStreamAttributes* attrv) static void osm_way(xg_string, const QXmlStreamAttributes* attrv) { - rte = route_head_alloc(); + rte = new route_head; // create a wpt to represent the route center if it has a center tag wpt = new Waypoint; if (attrv->hasAttribute("id")) { diff --git a/ozi.cc b/ozi.cc index e309f3cda..d6221406b 100644 --- a/ozi.cc +++ b/ozi.cc @@ -618,7 +618,7 @@ ozi_parse_track(int field, const QString& str, Waypoint* wpt_tmp, char* trk_name case 2: /* new track flag */ if ((str.toInt() == 1) && (trk_head->rte_waypt_ct > 0)) { - trk_head = route_head_alloc(); + trk_head = new route_head; track_add_head(trk_head); if (trk_name) { trk_head->rte_name = trk_name; @@ -711,7 +711,7 @@ ozi_parse_routeheader(int field, const QString& str) switch (field) { case 0: /* R */ - rte_head = route_head_alloc(); + rte_head = new route_head; route_add_head(rte_head); break; case 1: @@ -750,7 +750,7 @@ data_read() */ if (linecount == 1) { if (buff.contains("Track Point")) { - trk_head = route_head_alloc(); + trk_head = new route_head; track_add_head(trk_head); ozi_objective = trkdata; } else if (buff.contains("Route File")) { diff --git a/pcx.cc b/pcx.cc index e982d18a1..0ced2de88 100644 --- a/pcx.cc +++ b/pcx.cc @@ -199,18 +199,18 @@ static void data_read() { } if (track == nullptr) { if (ibuf[3] == 'L' && ibuf[4] == 'A') { - track = route_head_alloc(); + track = new route_head; track->rte_name = "track"; track_add_head(track); } else if (ibuf[3] == 'T' && ibuf[4] == 'N') { - track = route_head_alloc(); + track = new route_head; track->rte_name = &ibuf[6]; track_add_head(track); } } break; case 'R': - route = route_head_alloc(); + route = new route_head; route->rte_name = QString(&ibuf[1]).trimmed(); route_add_head(route); break; @@ -256,7 +256,7 @@ static void data_read() { /* Did we get a track point before a track header? */ if (track == nullptr) { - track = route_head_alloc(); + track = new route_head; track->rte_name = "Default"; track_add_head(track); } diff --git a/pocketfms_bc.cc b/pocketfms_bc.cc index d8ee1b117..12941cf1f 100644 --- a/pocketfms_bc.cc +++ b/pocketfms_bc.cc @@ -81,7 +81,7 @@ static void read_tracks() { breadcrumb bc; - route_head* trk_head = route_head_alloc(); + auto* trk_head = new route_head; trk_head->rte_num = 1; trk_head->rte_name = "PocketFMS"; trk_head->rte_desc = "Breadcrumb"; diff --git a/pocketfms_fp.cc b/pocketfms_fp.cc index 10bb7baed..dd52306ee 100644 --- a/pocketfms_fp.cc +++ b/pocketfms_fp.cc @@ -86,7 +86,7 @@ void wpt_s(xg_string, const QXmlStreamAttributes*) { if (isFirst == 1) { wpt_from = new Waypoint; - route = route_head_alloc(); + route = new route_head; route->rte_desc="PocketFMS flightplan"; route_add_head(route); } diff --git a/psitrex.cc b/psitrex.cc index afdc4bb42..460c87c98 100644 --- a/psitrex.cc +++ b/psitrex.cc @@ -400,7 +400,7 @@ psit_route_r(gbfile* psit_file, route_head** rte) rtrim(rtename); - route_head* rte_head = route_head_alloc(); + auto* rte_head = new route_head; rte_head->rte_name = rtename; route_add_head(rte_head); *rte = rte_head; @@ -561,7 +561,7 @@ psit_track_r(gbfile* psit_file, route_head**) psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), whitespace); if ((strcmp(psit_current_token, "1") == 0) || (track_head == nullptr)) { - track_head = route_head_alloc(); + track_head = new route_head; /* Add a number to the track name. With Garmins, the "first" tracklog is usually ACTIVE LOG the second is ACTIVE LOG001 and so on */ diff --git a/radius.cc b/radius.cc index c52389911..49ae52e64 100644 --- a/radius.cc +++ b/radius.cc @@ -105,7 +105,7 @@ void RadiusFilter::process() } if (routename) { - rte_head = route_head_alloc(); + rte_head = new route_head; rte_head->rte_name = routename; route_add_head(rte_head); } diff --git a/random.cc b/random.cc index c94b05375..0105e12be 100644 --- a/random.cc +++ b/random.cc @@ -239,7 +239,7 @@ random_read() int points = (opt_points) ? atoi(opt_points) : rand_int(128) + 1; if (doing_trks || doing_rtes) { - head = route_head_alloc(); + head = new route_head; if (doing_trks) { head->rte_name = rand_str(8, "Trk_%s"); track_add_head(head); diff --git a/raymarine.cc b/raymarine.cc index 7a7ea8996..773eb2130 100644 --- a/raymarine.cc +++ b/raymarine.cc @@ -238,7 +238,7 @@ raymarine_read() break; } - route_head* rte = route_head_alloc(); + auto* rte = new route_head; rte->rte_name = name; route_add_head(rte); diff --git a/route.cc b/route.cc index 08f739023..7fbfa0900 100644 --- a/route.cc +++ b/route.cc @@ -72,14 +72,6 @@ track_count() return global_track_list->count(); /* total # of tracks */ } -// FIXME: provide a method to deallocate a head that isn't added onto a route list, -// or just let the users allocate with new and deallocate with delete. -route_head* -route_head_alloc() -{ - return new route_head; -} - void route_add_head(route_head* rte) { @@ -484,7 +476,7 @@ RouteList::copy(RouteList** dst) const const char RPT[] = "RPT"; foreach (const route_head* rte_old, *this) { - route_head* rte_new = route_head_alloc(); + auto* rte_new = new route_head; // waypoint_list created below with add_wpt. rte_new->rte_name = rte_old->rte_name; rte_new->rte_desc = rte_old->rte_desc; diff --git a/saroute.cc b/saroute.cc index f26d58278..eac684804 100644 --- a/saroute.cc +++ b/saroute.cc @@ -168,7 +168,7 @@ my_read() * here lie the route description records */ if (version < 6 || (control == 1)) { - track_head = route_head_alloc(); + track_head = new route_head; route_add_head(track_head); if (control) { track_head->rte_name = "control points"; @@ -268,7 +268,7 @@ my_read() */ count = ReadLong(infile); if (count) { - track_head = route_head_alloc(); + track_head = new route_head; if (timesynth) { track_add_head(track_head); } else { @@ -287,7 +287,7 @@ my_read() if (split && stringlen) { if (track_head->rte_waypt_ct) { old_track_head = track_head; - track_head = route_head_alloc(); + track_head = new route_head; if (timesynth) { track_add_head(track_head); } else { diff --git a/sbn.cc b/sbn.cc index 7633a1c8b..71b56f728 100644 --- a/sbn.cc +++ b/sbn.cc @@ -289,7 +289,7 @@ static void sbn_read() { if (global_opts.masked_objective & TRKDATAMASK) { - route_head* track = route_head_alloc(); + auto* track = new route_head; track_add_head(track); read_sbn_header(track); diff --git a/sbp.cc b/sbp.cc index 24e27f4f5..5921fe48c 100644 --- a/sbp.cc +++ b/sbp.cc @@ -98,7 +98,7 @@ sbp_read() { Waypoint* logpoint; - route_head* track = route_head_alloc(); + auto* track = new route_head; track_add_head(track); read_sbp_header(track); diff --git a/shape.cc b/shape.cc index 05239e369..7e95979f3 100644 --- a/shape.cc +++ b/shape.cc @@ -325,7 +325,7 @@ my_read() // Parts may or may not be connected to one another. // Parts may or may not intersect one another. for (int part=0; part < shp->nParts; part++) { - route_head* routehead = route_head_alloc(); + auto* routehead = new route_head; routehead->rte_name = name; route_add_head(routehead); int endVertex; diff --git a/skyforce.cc b/skyforce.cc index edb7ae0dc..9c349f884 100644 --- a/skyforce.cc +++ b/skyforce.cc @@ -282,7 +282,7 @@ skyforce_read() } if (rte == nullptr) { - rte = route_head_alloc(); + rte = new route_head; route_add_head(rte); rte->rte_num = rte_num; } @@ -295,7 +295,7 @@ skyforce_read() continue; } if (trk == nullptr) { - trk = route_head_alloc(); + trk = new route_head; track_add_head(trk); } track_add_wpt(trk, wpt); diff --git a/skytraq.cc b/skytraq.cc index 1972034b7..fabd379ed 100644 --- a/skytraq.cc +++ b/skytraq.cc @@ -675,7 +675,7 @@ struct read_state { static void state_init(struct read_state* pst) { - route_head* track = route_head_alloc(); + auto* track = new route_head; track->rte_name = "SkyTraq tracklog"; track->rte_desc = "SkyTraq GPS tracklog data"; track_add_head(track); @@ -899,7 +899,7 @@ process_data_item(struct read_state* pst, const item_frame* pitem, int len) if (nullptr == pst->route_head_) { db(1, MYNAME ": New Track\n"); - pst->route_head_ = route_head_alloc(); + pst->route_head_ = new route_head; track_add_head(pst->route_head_); } diff --git a/stmsdf.cc b/stmsdf.cc index 65c98c8c3..40847b959 100644 --- a/stmsdf.cc +++ b/stmsdf.cc @@ -203,7 +203,7 @@ finalize_tracks() track = nullptr; } if (track == nullptr) { - track = route_head_alloc(); + track = new route_head; track_add_head(track); trackno++; if (rte_name != nullptr) { @@ -365,7 +365,7 @@ parse_point(char *line) { case 2: case 3: if (route == nullptr) { - route = route_head_alloc(); + route = new route_head; route_add_head(route); } route_add_wpt(route, wpt); diff --git a/stmwpp.cc b/stmwpp.cc index a75b31411..a147cf1bc 100644 --- a/stmwpp.cc +++ b/stmwpp.cc @@ -171,7 +171,7 @@ stmwpp_data_read() waypt_add(wpt); if (global_opts.objective == rtedata) { if (route == nullptr) { - route = route_head_alloc(); + route = new route_head; route_add_head(route); } route_add_wpt(route, new Waypoint(*wpt)); @@ -180,7 +180,7 @@ stmwpp_data_read() case STM_TRKPT: if (track == nullptr) { - track = route_head_alloc(); + track = new route_head; track_add_head(track); } track_add_wpt(track, wpt); diff --git a/tef_xml.cc b/tef_xml.cc index b54ea3d22..f5bc91626 100644 --- a/tef_xml.cc +++ b/tef_xml.cc @@ -92,7 +92,7 @@ tef_start(xg_string, const QXmlStreamAttributes* attrv) static void tef_header(xg_string, const QXmlStreamAttributes* attrv) { - route = route_head_alloc(); + route = new route_head; foreach(QXmlStreamAttribute attr, *attrv) { if (attr.name().compare(QLatin1String("Name"), Qt::CaseInsensitive) == 0) { route->rte_name = attr.value().toString().trimmed(); diff --git a/tpo.cc b/tpo.cc index 61fa193a2..f1d014d87 100644 --- a/tpo.cc +++ b/tpo.cc @@ -273,7 +273,7 @@ static void tpo_read_2_x() for (int i = 0; i < track_count; i++) { - route_head* track_temp = route_head_alloc(); + auto* track_temp = new route_head; track_add_head(track_temp); /* generate a generic track name */ @@ -603,7 +603,7 @@ static void tpo_process_tracks() char rgb[7],bgr[7]; // Allocate the track struct - route_head* track_temp = route_head_alloc(); + auto* track_temp = new route_head; track_add_head(track_temp); //UNKNOWN DATA LENGTH @@ -1116,7 +1116,7 @@ static void tpo_process_routes() // for (unsigned int ii = 0; ii < route_count; ii++) { // Allocate the route struct - route_head* route_temp = route_head_alloc(); + auto* route_temp = new route_head; route_add_head(route_temp); //UNKNOWN DATA LENGTH diff --git a/trackfilter.cc b/trackfilter.cc index 0e6d40015..8a5ec100b 100644 --- a/trackfilter.cc +++ b/trackfilter.cc @@ -547,7 +547,7 @@ void TrackFilter::trackfilter_split() #ifdef TRACKF_DBG printf(MYNAME ": splitting new track\n"); #endif - curr = route_head_alloc(); + curr = new route_head; trackfilter_split_init_rte_name(curr, buff.at(j)->GetCreationTime()); track_add_head(curr); track_list.append(curr); @@ -752,7 +752,7 @@ void TrackFilter::trackfilter_seg2trk() foreach (Waypoint* wpt, src->waypoint_list) { if (wpt->wpt_flags.new_trkseg && !first) { - dest = route_head_alloc(); + dest = new route_head; dest->rte_num = src->rte_num; /* name in the form TRACKNAME #n */ if (!src->rte_name.isEmpty()) { diff --git a/transform.cc b/transform.cc index 29a2ad111..e53ddb7f1 100644 --- a/transform.cc +++ b/transform.cc @@ -37,7 +37,7 @@ void TransformFilter::transform_waypoints() { - route_head* rte = route_head_alloc(); + auto* rte = new route_head; switch (current_target) { case 'R': route_add_head(rte); @@ -67,7 +67,7 @@ void TransformFilter::transform_rte_disp_hdr_cb(const route_head* rte) current_namepart = rte->rte_name; } if (current_target == 'T') { - current_trk = route_head_alloc(); + current_trk = new route_head; track_add_head(current_trk); if (!rte->rte_name.isEmpty()) { current_trk->rte_desc = QString("Generated from route %1").arg(rte->rte_name); @@ -83,7 +83,7 @@ void TransformFilter::transform_trk_disp_hdr_cb(const route_head* trk) current_namepart = trk->rte_name; } if (current_target == 'R') { - current_rte = route_head_alloc(); + current_rte = new route_head; route_add_head(current_rte); if (!trk->rte_name.isEmpty()) { current_rte->rte_desc = "Generated from track "; diff --git a/unicsv.cc b/unicsv.cc index 50ed4e6bb..63a966e25 100644 --- a/unicsv.cc +++ b/unicsv.cc @@ -1225,14 +1225,14 @@ unicsv_parse_one_line(const QString& ibuf) switch (unicsv_data_type) { case rtedata: if (! unicsv_route) { - unicsv_route = route_head_alloc(); + unicsv_route = new route_head; route_add_head(unicsv_route); } route_add_wpt(unicsv_route, wpt); break; case trkdata: if (! unicsv_track) { - unicsv_track = route_head_alloc(); + unicsv_track = new route_head; track_add_head(unicsv_track); } track_add_wpt(unicsv_track, wpt); diff --git a/units.cc b/units.cc index 746f55574..aafdf90a6 100644 --- a/units.cc +++ b/units.cc @@ -133,4 +133,4 @@ fmt_speed(const double distance_meters_sec, const char** tag) } return d; -} \ No newline at end of file +} diff --git a/v900.cc b/v900.cc index 2867dc638..5766030c9 100644 --- a/v900.cc +++ b/v900.cc @@ -225,7 +225,7 @@ v900_read() v900_log("header line: %s",line.text); v900_log("is_advance_mode=%d\n",is_advanced_mode); - route_head* track = route_head_alloc(); + auto* track = new route_head; track->rte_name = "V900 tracklog"; track->rte_desc = "V900 GPS tracklog data"; track_add_head(track); diff --git a/vidaone.cc b/vidaone.cc index 6d0fd16e0..d0fa519aa 100644 --- a/vidaone.cc +++ b/vidaone.cc @@ -91,7 +91,7 @@ vidaone_read() } if (!trk) { - trk = route_head_alloc(); + trk = new route_head; track_add_head(trk); } diff --git a/vitosmt.cc b/vitosmt.cc index 81b743c87..9823e857d 100644 --- a/vitosmt.cc +++ b/vitosmt.cc @@ -68,7 +68,7 @@ rd_deinit() static void vitosmt_read() { - route_head* route_head =nullptr; + route_head* rte = nullptr; struct tm tmStruct; int serial =0; @@ -174,17 +174,17 @@ vitosmt_read() if (doing_wpts) { /* process as waypoints */ waypt_add(wpt_tmp); } else if (doing_rtes) { /* process as route */ - if (route_head == nullptr) { - route_head = route_head_alloc(); - route_add_head(route_head); + if (rte == nullptr) { + rte = new route_head; + route_add_head(rte); } - route_add_wpt(route_head, wpt_tmp); + route_add_wpt(rte, wpt_tmp); } else { /* default track mode */ - if (route_head == nullptr) { - route_head = route_head_alloc(); - track_add_head(route_head); + if (rte == nullptr) { + rte = new route_head; + track_add_head(rte); } - track_add_wpt(route_head, wpt_tmp); + track_add_wpt(rte, wpt_tmp); } xfree(timestamp); diff --git a/vitovtt.cc b/vitovtt.cc index f5b91fb2e..a1fc2addf 100644 --- a/vitovtt.cc +++ b/vitovtt.cc @@ -61,8 +61,8 @@ vitovtt_read() memset(&tmStruct, 0, sizeof(tmStruct)); - route_head* route_head = route_head_alloc(); - track_add_head(route_head); + auto* rte = new route_head; + track_add_head(rte); /* Read the header. */ int version = gbfgetint32(infile); @@ -104,7 +104,7 @@ vitovtt_read() (void) course; (void) status; - track_add_wpt(route_head, wpt_tmp); + track_add_wpt(rte, wpt_tmp); count--; } diff --git a/vpl.cc b/vpl.cc index 6f9d7cfc1..574b2a418 100644 --- a/vpl.cc +++ b/vpl.cc @@ -143,7 +143,7 @@ vpl_read() // Set up a track if (track_head == nullptr) { - track_head = route_head_alloc(); + track_head = new route_head; track_add_head(track_head); } diff --git a/wbt-200.cc b/wbt-200.cc index fdf6dee95..6fc2a0cc6 100644 --- a/wbt-200.cc +++ b/wbt-200.cc @@ -595,7 +595,7 @@ static int wbt200_data_chunk(struct read_state* st, const void* buf, int fmt) if (nullptr == st->route_head_) { db(1, "New Track\n"); - st->route_head_ = route_head_alloc(); + st->route_head_ = new route_head; track_add_head(st->route_head_); } @@ -827,7 +827,7 @@ static int wbt201_data_chunk(struct read_state* st, const void* buf) if (nullptr == st->route_head_) { db(1, "New Track\n"); - st->route_head_ = route_head_alloc(); + st->route_head_ = new route_head; track_add_head(st->route_head_); } diff --git a/wintec_tes.cc b/wintec_tes.cc index c5b53aa3d..bef8fca28 100644 --- a/wintec_tes.cc +++ b/wintec_tes.cc @@ -56,7 +56,7 @@ wintec_date_to_time(uint32_t w) static void wintec_tes_read() { - route_head* trk = route_head_alloc(); + auto* trk = new route_head; track_add_head(trk); while (!gbfeof(fin)) { diff --git a/xcsv.cc b/xcsv.cc index a9750bc4c..8a0725bd2 100644 --- a/xcsv.cc +++ b/xcsv.cc @@ -926,7 +926,7 @@ XcsvFormat::read() break; case trkdata: if ((trk == nullptr) || parse_data.new_track) { - trk = route_head_alloc(); + trk = new route_head; track_add_head(trk); } if (!parse_data.trk_name.isEmpty()) { @@ -936,7 +936,7 @@ XcsvFormat::read() break; case rtedata: if (rte == nullptr) { - rte = route_head_alloc(); + rte = new route_head; route_add_head(rte); } if (!parse_data.rte_name.isEmpty()) { diff --git a/xol.cc b/xol.cc index 7ec4a219c..76cb7d1b4 100644 --- a/xol.cc +++ b/xol.cc @@ -68,7 +68,7 @@ static void xol_shape(xg_string, const QXmlStreamAttributes* attrv) { if (attrv->value("type") == "waypoint") { wpt = new Waypoint; } else if (attrv->value("type") == "polyline") { - trk = route_head_alloc(); + trk = new route_head; track_add_head(trk); } } -- 2.30.2